package com.smforj.ssm.modules.lib.service.impl;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.smforj.ssm.modules.lib.dao.SysReaderWechatDao;
import com.smforj.ssm.modules.lib.domain.SysReaderWechat;
import com.smforj.ssm.modules.lib.service.ReaderWechatService;


/***
 * 操作微信与用户关系表
 * 
 * @author Haijun Gao 
 * @date 2016-8-16 下午1:07:42
 * @desp http://www.cnblogs.com/saga5998/
 * @email 573107773@qq.com
 */
@Service
public class ReaderWechatServiceImpl implements ReaderWechatService {
	private Logger log = Logger.getLogger(this.getClass()); 
	
	@Autowired
	private SysReaderWechatDao readerWechatDao;

	@Override
	public SysReaderWechat getReaderWechat(String openid) { 
		try{
			return readerWechatDao.selectByAppid(openid); 
		}catch(Exception ex)
		{
			log.error("根据appid查询微信用户信息异常："+ex.getMessage());
			return null;
		}
	}

	@Override
	public Boolean saveReaderWechat(SysReaderWechat model) { 
		return readerWechatDao.insert(model) > 0 ? true :false;
	}

}
